package com.ruoyi.web.controller.material;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.*;
import com.ruoyi.system.domain.vo.PurchaseVo;
import com.ruoyi.system.service.SaveService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;

@Api(tags = "领取采购接口")
@RestController
@RequestMapping("/material")
public class SaveController{

    @Autowired
    private SaveService saveService;

    /**
     * 保存采购单
     * @param requestPurchase
     * @return
     */
    @ApiOperation("保存采购单")
    @PostMapping("/savePurchase")
    public AjaxResult savePurchase(@RequestBody RequestPurchase requestPurchase){
        return saveService.savePurchase(requestPurchase);
    }


    /**
     * 保存领用单
     * @param requestReceive
     * @return
     */
    @ApiOperation("保存领用单")
    @PostMapping("/saveReceive")
    public AjaxResult saveReceive(@RequestBody RequestReceive requestReceive){
        return saveService.saveReceive(requestReceive);
    }

}
